{% extends "base.html" %}
{% block title %}用户角色与权限管理 - YOUER的电子公文系统{% endblock %}
{% block content %}
<div class="card">
  <div class="card-header">
    <h3>用户角色与权限列表</h3>
  </div>
  <div class="card-body">
    {% if users_data %}
    <table class="table table-striped">
      <thead>
        <tr>
          <th scope="col">用户ID</th>
          <th scope="col">角色</th>
          <th scope="col">权限</th>
        </tr>
      </thead>
      <tbody>
        {% for user_id, info in users_data.items() %}
        <tr>
          <td>{{ user_id }}</td>
          <td>
            {% for role in info.roles %}
            {{ role }}
            {% if not loop.last %}<br>{% endif %}
            {% endfor %}
          </td>
          <td>
            {% for permission in info.permissions %}
            {{ permission }}
            {% if not loop.last %}<br>{% endif %}
            {% endfor %}
          </td>
        </tr>
        {% endfor %}
      </tbody>
    </table>
    {% else %}
    <p class="text-center">暂无用户角色与权限信息可展示。</p>
    {% endif %}
  </div>
</div>
{% endblock %}